Optimal. Leaf size=279 \[ -\frac {b^2 \left (-3 a^2 d+2 a b c-b^2 d\right )}{f \left (a^2+b^2\right )^2 (b c-a d)^2 (a+b \tan (e+f x))}-\frac {b^2}{2 f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))^2}+\frac {x \left (a^3 c-3 a^2 b d-3 a b^2 c+b^3 d\right )}{\left (a^2+b^2\right )^3 \left (c^2+d^2\right )}-\frac {b^2 \left (-6 a^4 d^2+8 a^3 b c d-3 a^2 b^2 \left (c^2+d^2\right )+b^4 \left (c^2-d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3 (b c-a d)^3}-\frac {d^4 \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right ) (b c-a d)^3} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.93, antiderivative size = 279, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.160, Rules used = {3569, 3649, 3651, 3530} \[ -\frac {b^2 \left (-3 a^2 b^2 \left (c^2+d^2\right )+8 a^3 b c d-6 a^4 d^2+b^4 \left (c^2-d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3 (b c-a d)^3}+\frac {x \left (-3 a^2 b d+a^3 c-3 a b^2 c+b^3 d\right )}{\left (a^2+b^2\right )^3 \left (c^2+d^2\right )}-\frac {b^2 \left (-3 a^2 d+2 a b c-b^2 d\right )}{f \left (a^2+b^2\right )^2 (b c-a d)^2 (a+b \tan (e+f x))}-\frac {b^2}{2 f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))^2}-\frac {d^4 \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right ) (b c-a d)^3} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3530
Rule 3569
Rule 3649
Rule 3651
Rubi steps
\begin {align*} \int \frac {1}{(a+b \tan (e+f x))^3 (c+d \tan (e+f x))} \, dx &=-\frac {b^2}{2 \left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))^2}-\frac {\int \frac {-2 \left (a b c-a^2 d-b^2 d\right )+2 b (b c-a d) \tan (e+f x)+2 b^2 d \tan ^2(e+f x)}{(a+b \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx}{2 \left (a^2+b^2\right ) (b c-a d)}\\ &=-\frac {b^2}{2 \left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))^2}-\frac {b^2 \left (2 a b c-3 a^2 d-b^2 d\right )}{\left (a^2+b^2\right )^2 (b c-a d)^2 f (a+b \tan (e+f x))}+\frac {\int \frac {-2 \left (2 a^3 b c d-a^4 d^2+b^4 \left (c^2-d^2\right )-a^2 b^2 \left (c^2+2 d^2\right )\right )-4 a b (b c-a d)^2 \tan (e+f x)-2 b^2 d \left (2 a b c-3 a^2 d-b^2 d\right ) \tan ^2(e+f x)}{(a+b \tan (e+f x)) (c+d \tan (e+f x))} \, dx}{2 \left (a^2+b^2\right )^2 (b c-a d)^2}\\ &=\frac {\left (a^3 c-3 a b^2 c-3 a^2 b d+b^3 d\right ) x}{\left (a^2+b^2\right )^3 \left (c^2+d^2\right )}-\frac {b^2}{2 \left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))^2}-\frac {b^2 \left (2 a b c-3 a^2 d-b^2 d\right )}{\left (a^2+b^2\right )^2 (b c-a d)^2 f (a+b \tan (e+f x))}-\frac {d^4 \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{(b c-a d)^3 \left (c^2+d^2\right )}-\frac {\left (b^2 \left (8 a^3 b c d-6 a^4 d^2+b^4 \left (c^2-d^2\right )-3 a^2 b^2 \left (c^2+d^2\right )\right )\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^3 (b c-a d)^3}\\ &=\frac {\left (a^3 c-3 a b^2 c-3 a^2 b d+b^3 d\right ) x}{\left (a^2+b^2\right )^3 \left (c^2+d^2\right )}-\frac {b^2 \left (8 a^3 b c d-6 a^4 d^2+b^4 \left (c^2-d^2\right )-3 a^2 b^2 \left (c^2+d^2\right )\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 (b c-a d)^3 f}-\frac {d^4 \log (c \cos (e+f x)+d \sin (e+f x))}{(b c-a d)^3 \left (c^2+d^2\right ) f}-\frac {b^2}{2 \left (a^2+b^2\right ) (b c-a d) f (a+b \tan (e+f x))^2}-\frac {b^2 \left (2 a b c-3 a^2 d-b^2 d\right )}{\left (a^2+b^2\right )^2 (b c-a d)^2 f (a+b \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A] time = 6.89, size = 529, normalized size = 1.90 \[ -\frac {b^2}{2 f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))^2}-\frac {-\frac {-2 b^2 \left (a^2 (-d)+a b c-b^2 d\right )-a \left (2 b^2 (b c-a d)-2 a b^2 d\right )}{f \left (a^2+b^2\right ) (b c-a d) (a+b \tan (e+f x))}-\frac {-\frac {2 b d^4 \left (a^2+b^2\right )^2 \log (c+d \tan (e+f x))}{\left (c^2+d^2\right ) (b c-a d)}-\frac {b (b c-a d)^2 \left (a^3 d+3 a^2 b c+\frac {\sqrt {-b^2} \left (a^3 c-3 a^2 b d-3 a b^2 c+b^3 d\right )}{b}-3 a b^2 d-b^3 c\right ) \log \left (\sqrt {-b^2}-b \tan (e+f x)\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )}-\frac {b (b c-a d)^2 \left (a^3 d+3 a^2 b c+\frac {b \left (a^3 c-3 a^2 b d-3 a b^2 c+b^3 d\right )}{\sqrt {-b^2}}-3 a b^2 d-b^3 c\right ) \log \left (\sqrt {-b^2}+b \tan (e+f x)\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )}-\frac {2 b^3 \left (-6 a^4 d^2+8 a^3 b c d-3 a^2 b^2 \left (c^2+d^2\right )+b^4 \left (c^2-d^2\right )\right ) \log (a+b \tan (e+f x))}{\left (a^2+b^2\right ) (b c-a d)}}{b f \left (a^2+b^2\right ) (b c-a d)}}{2 \left (a^2+b^2\right ) (b c-a d)} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 2.01, size = 1927, normalized size = 6.91 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 1.66, size = 1111, normalized size = 3.98 \[ -\frac {\frac {2 \, d^{5} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{b^{3} c^{5} d - 3 \, a b^{2} c^{4} d^{2} + 3 \, a^{2} b c^{3} d^{3} + b^{3} c^{3} d^{3} - a^{3} c^{2} d^{4} - 3 \, a b^{2} c^{2} d^{4} + 3 \, a^{2} b c d^{5} - a^{3} d^{6}} - \frac {2 \, {\left (a^{3} c - 3 \, a b^{2} c - 3 \, a^{2} b d + b^{3} d\right )} {\left (f x + e\right )}}{a^{6} c^{2} + 3 \, a^{4} b^{2} c^{2} + 3 \, a^{2} b^{4} c^{2} + b^{6} c^{2} + a^{6} d^{2} + 3 \, a^{4} b^{2} d^{2} + 3 \, a^{2} b^{4} d^{2} + b^{6} d^{2}} + \frac {{\left (3 \, a^{2} b c - b^{3} c + a^{3} d - 3 \, a b^{2} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} c^{2} + 3 \, a^{4} b^{2} c^{2} + 3 \, a^{2} b^{4} c^{2} + b^{6} c^{2} + a^{6} d^{2} + 3 \, a^{4} b^{2} d^{2} + 3 \, a^{2} b^{4} d^{2} + b^{6} d^{2}} - \frac {2 \, {\left (3 \, a^{2} b^{5} c^{2} - b^{7} c^{2} - 8 \, a^{3} b^{4} c d + 6 \, a^{4} b^{3} d^{2} + 3 \, a^{2} b^{5} d^{2} + b^{7} d^{2}\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{6} b^{4} c^{3} + 3 \, a^{4} b^{6} c^{3} + 3 \, a^{2} b^{8} c^{3} + b^{10} c^{3} - 3 \, a^{7} b^{3} c^{2} d - 9 \, a^{5} b^{5} c^{2} d - 9 \, a^{3} b^{7} c^{2} d - 3 \, a b^{9} c^{2} d + 3 \, a^{8} b^{2} c d^{2} + 9 \, a^{6} b^{4} c d^{2} + 9 \, a^{4} b^{6} c d^{2} + 3 \, a^{2} b^{8} c d^{2} - a^{9} b d^{3} - 3 \, a^{7} b^{3} d^{3} - 3 \, a^{5} b^{5} d^{3} - a^{3} b^{7} d^{3}} + \frac {9 \, a^{2} b^{6} c^{2} \tan \left (f x + e\right )^{2} - 3 \, b^{8} c^{2} \tan \left (f x + e\right )^{2} - 24 \, a^{3} b^{5} c d \tan \left (f x + e\right )^{2} + 18 \, a^{4} b^{4} d^{2} \tan \left (f x + e\right )^{2} + 9 \, a^{2} b^{6} d^{2} \tan \left (f x + e\right )^{2} + 3 \, b^{8} d^{2} \tan \left (f x + e\right )^{2} + 22 \, a^{3} b^{5} c^{2} \tan \left (f x + e\right ) - 2 \, a b^{7} c^{2} \tan \left (f x + e\right ) - 58 \, a^{4} b^{4} c d \tan \left (f x + e\right ) - 12 \, a^{2} b^{6} c d \tan \left (f x + e\right ) - 2 \, b^{8} c d \tan \left (f x + e\right ) + 42 \, a^{5} b^{3} d^{2} \tan \left (f x + e\right ) + 26 \, a^{3} b^{5} d^{2} \tan \left (f x + e\right ) + 8 \, a b^{7} d^{2} \tan \left (f x + e\right ) + 14 \, a^{4} b^{4} c^{2} + 3 \, a^{2} b^{6} c^{2} + b^{8} c^{2} - 36 \, a^{5} b^{3} c d - 16 \, a^{3} b^{5} c d - 4 \, a b^{7} c d + 25 \, a^{6} b^{2} d^{2} + 19 \, a^{4} b^{4} d^{2} + 6 \, a^{2} b^{6} d^{2}}{{\left (a^{6} b^{3} c^{3} + 3 \, a^{4} b^{5} c^{3} + 3 \, a^{2} b^{7} c^{3} + b^{9} c^{3} - 3 \, a^{7} b^{2} c^{2} d - 9 \, a^{5} b^{4} c^{2} d - 9 \, a^{3} b^{6} c^{2} d - 3 \, a b^{8} c^{2} d + 3 \, a^{8} b c d^{2} + 9 \, a^{6} b^{3} c d^{2} + 9 \, a^{4} b^{5} c d^{2} + 3 \, a^{2} b^{7} c d^{2} - a^{9} d^{3} - 3 \, a^{7} b^{2} d^{3} - 3 \, a^{5} b^{4} d^{3} - a^{3} b^{6} d^{3}\right )} {\left (b \tan \left (f x + e\right ) + a\right )}^{2}}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.39, size = 747, normalized size = 2.68 \[ \frac {b^{2}}{2 f \left (d a -c b \right ) \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )^{2}}+\frac {3 b^{2} a^{2} d}{f \left (d a -c b \right )^{2} \left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}-\frac {2 b^{3} a c}{f \left (d a -c b \right )^{2} \left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}+\frac {b^{4} d}{f \left (d a -c b \right )^{2} \left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (f x +e \right )\right )}-\frac {6 b^{2} \ln \left (a +b \tan \left (f x +e \right )\right ) a^{4} d^{2}}{f \left (d a -c b \right )^{3} \left (a^{2}+b^{2}\right )^{3}}+\frac {8 b^{3} \ln \left (a +b \tan \left (f x +e \right )\right ) a^{3} c d}{f \left (d a -c b \right )^{3} \left (a^{2}+b^{2}\right )^{3}}-\frac {3 b^{4} \ln \left (a +b \tan \left (f x +e \right )\right ) a^{2} c^{2}}{f \left (d a -c b \right )^{3} \left (a^{2}+b^{2}\right )^{3}}-\frac {3 b^{4} \ln \left (a +b \tan \left (f x +e \right )\right ) a^{2} d^{2}}{f \left (d a -c b \right )^{3} \left (a^{2}+b^{2}\right )^{3}}+\frac {b^{6} \ln \left (a +b \tan \left (f x +e \right )\right ) c^{2}}{f \left (d a -c b \right )^{3} \left (a^{2}+b^{2}\right )^{3}}-\frac {b^{6} \ln \left (a +b \tan \left (f x +e \right )\right ) d^{2}}{f \left (d a -c b \right )^{3} \left (a^{2}+b^{2}\right )^{3}}+\frac {d^{4} \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (d a -c b \right )^{3} \left (c^{2}+d^{2}\right )}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{3} d}{2 f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )}-\frac {3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} b c}{2 f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )}+\frac {3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a \,b^{2} d}{2 f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c \,b^{3}}{2 f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) a^{3} c}{f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )}-\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) a^{2} b d}{f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )}-\frac {3 \arctan \left (\tan \left (f x +e \right )\right ) a \,b^{2} c}{f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )}+\frac {\arctan \left (\tan \left (f x +e \right )\right ) b^{3} d}{f \left (a^{2}+b^{2}\right )^{3} \left (c^{2}+d^{2}\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [B] time = 1.03, size = 801, normalized size = 2.87 \[ -\frac {\frac {2 \, d^{4} \log \left (d \tan \left (f x + e\right ) + c\right )}{b^{3} c^{5} - 3 \, a b^{2} c^{4} d + 3 \, a^{2} b c d^{4} - a^{3} d^{5} + {\left (3 \, a^{2} b + b^{3}\right )} c^{3} d^{2} - {\left (a^{3} + 3 \, a b^{2}\right )} c^{2} d^{3}} - \frac {2 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c - {\left (3 \, a^{2} b - b^{3}\right )} d\right )} {\left (f x + e\right )}}{{\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} c^{2} + {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} d^{2}} + \frac {2 \, {\left (8 \, a^{3} b^{3} c d - {\left (3 \, a^{2} b^{4} - b^{6}\right )} c^{2} - {\left (6 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} d^{2}\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{{\left (a^{6} b^{3} + 3 \, a^{4} b^{5} + 3 \, a^{2} b^{7} + b^{9}\right )} c^{3} - 3 \, {\left (a^{7} b^{2} + 3 \, a^{5} b^{4} + 3 \, a^{3} b^{6} + a b^{8}\right )} c^{2} d + 3 \, {\left (a^{8} b + 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} + a^{2} b^{7}\right )} c d^{2} - {\left (a^{9} + 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} + a^{3} b^{6}\right )} d^{3}} + \frac {{\left ({\left (3 \, a^{2} b - b^{3}\right )} c + {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{{\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} c^{2} + {\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} d^{2}} + \frac {{\left (5 \, a^{2} b^{3} + b^{5}\right )} c - {\left (7 \, a^{3} b^{2} + 3 \, a b^{4}\right )} d + 2 \, {\left (2 \, a b^{4} c - {\left (3 \, a^{2} b^{3} + b^{5}\right )} d\right )} \tan \left (f x + e\right )}{{\left (a^{6} b^{2} + 2 \, a^{4} b^{4} + a^{2} b^{6}\right )} c^{2} - 2 \, {\left (a^{7} b + 2 \, a^{5} b^{3} + a^{3} b^{5}\right )} c d + {\left (a^{8} + 2 \, a^{6} b^{2} + a^{4} b^{4}\right )} d^{2} + {\left ({\left (a^{4} b^{4} + 2 \, a^{2} b^{6} + b^{8}\right )} c^{2} - 2 \, {\left (a^{5} b^{3} + 2 \, a^{3} b^{5} + a b^{7}\right )} c d + {\left (a^{6} b^{2} + 2 \, a^{4} b^{4} + a^{2} b^{6}\right )} d^{2}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left ({\left (a^{5} b^{3} + 2 \, a^{3} b^{5} + a b^{7}\right )} c^{2} - 2 \, {\left (a^{6} b^{2} + 2 \, a^{4} b^{4} + a^{2} b^{6}\right )} c d + {\left (a^{7} b + 2 \, a^{5} b^{3} + a^{3} b^{5}\right )} d^{2}\right )} \tan \left (f x + e\right )}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 12.02, size = 609, normalized size = 2.18 \[ \frac {d^4\,\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}{f\,{\left (a\,d-b\,c\right )}^3\,\left (c^2+d^2\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )}{2\,f\,\left (a^3\,c\,1{}\mathrm {i}-a^3\,d+b^3\,c+b^3\,d\,1{}\mathrm {i}-a\,b^2\,c\,3{}\mathrm {i}-3\,a^2\,b\,c+3\,a\,b^2\,d-a^2\,b\,d\,3{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )}{2\,f\,\left (a^3\,c\,1{}\mathrm {i}+a^3\,d-b^3\,c+b^3\,d\,1{}\mathrm {i}-a\,b^2\,c\,3{}\mathrm {i}+3\,a^2\,b\,c-3\,a\,b^2\,d-a^2\,b\,d\,3{}\mathrm {i}\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (b^4\,\left (3\,a^2\,c^2+3\,a^2\,d^2\right )-b^6\,\left (c^2-d^2\right )+6\,a^4\,b^2\,d^2-8\,a^3\,b^3\,c\,d\right )}{f\,\left (a^9\,d^3-3\,a^8\,b\,c\,d^2+3\,a^7\,b^2\,c^2\,d+3\,a^7\,b^2\,d^3-a^6\,b^3\,c^3-9\,a^6\,b^3\,c\,d^2+9\,a^5\,b^4\,c^2\,d+3\,a^5\,b^4\,d^3-3\,a^4\,b^5\,c^3-9\,a^4\,b^5\,c\,d^2+9\,a^3\,b^6\,c^2\,d+a^3\,b^6\,d^3-3\,a^2\,b^7\,c^3-3\,a^2\,b^7\,c\,d^2+3\,a\,b^8\,c^2\,d-b^9\,c^3\right )}-\frac {\frac {-7\,d\,a^3\,b^2+5\,c\,a^2\,b^3-3\,d\,a\,b^4+c\,b^5}{2\,\left (a^2\,d^2-2\,a\,b\,c\,d+b^2\,c^2\right )\,\left (a^4+2\,a^2\,b^2+b^4\right )}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (3\,d\,a^2\,b^3-2\,c\,a\,b^4+d\,b^5\right )}{\left (a^2\,d^2-2\,a\,b\,c\,d+b^2\,c^2\right )\,\left (a^4+2\,a^2\,b^2+b^4\right )}}{f\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (e+f\,x\right )+b^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotImplementedError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________